package com.tanhua.model.vo;

import com.tanhua.model.db.UserInfo;
import com.tanhua.model.mongo.Peachblossom;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

/**
 * 桃花传音vo
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PeachblossomVo {
    private Long id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String birthday; //生日
    private String gender; //性别
    private Integer age; //年龄
    private String soundUrl;//语音地址
    private Integer remainingTimes;//剩余次数

    public static PeachblossomVo init(UserInfo userInfo, Peachblossom item) {
        PeachblossomVo vo = new PeachblossomVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo,vo);
        //copy桃花传音属性
        BeanUtils.copyProperties(item,vo);
        return vo;
    }
    public static PeachblossomVo init(UserInfo userInfo) {
        PeachblossomVo vo = new PeachblossomVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo,vo);
        return vo;
    }
}
